package com.example.dqdq.lzyim_asm_tvapp;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Toast;

import com.example.dqdq.lzyim_asm_tvapp.utils.ActivityCollector;
import com.umeng.analytics.MobclickAgent;


public class UserGuideActivity extends BaseActivity {

    private Button acceptBtn;
    private CheckBox acceptChbx;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_guide);
        ActivityCollector.addActivity(this);

        initView();
    }
    public void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }
    public void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }
    private void initView() {
        acceptBtn = (Button) findViewById(R.id.acceptBtn);
        acceptChbx = (CheckBox) findViewById(R.id.acceptCbx);

        acceptBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (acceptChbx.isChecked()) {
                    Intent intent = new Intent(UserGuideActivity.this, QRcodeActivity.class);
                    startActivity(intent);
                    finish();
                } else
                    showToask("请先阅读协议");
            }
        });
    }

    private void showToask(String msg) {
        Toast.makeText(UserGuideActivity.this, msg, Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        ActivityCollector.removeActivity(this);
    }
}
